﻿/* 
  Limits: Row Size: 8060
  Index size: 512, 
		Longer keys are supported, 
		but the data is truncated 
		and a checksum is added at the end
*/

CREATE TABLE [SimpleQueue] (
	[Id] [nvarchar](26) NOT NULL,
	[OptionalKey] [nvarchar](248) NULL,
	[QueueName] [nvarchar](248) NOT NULL,
	[Payload] image NOT NULL,
	[CreatedAt] [datetime] NOT NULL,
	[ModifiedAt] [datetime] NOT NULL,
	[AckDate] [datetime] NULL,
	[HandlersCount] [int] NOT NULL,
	[DeliveryDate] [datetime] NULL,
	[Locked] [bit] NOT NULL,
    CONSTRAINT [PK_SimpleQueue] PRIMARY KEY ([Id])
)
GO

CREATE NONCLUSTERED INDEX [IX_SimpleQueue_NextDelivery] ON [SimpleQueue]
(
	[QueueName] ASC,
	[ModifiedAt] ASC
)
GO

CREATE NONCLUSTERED INDEX [IX_SimpleQueue_Key] ON [SimpleQueue]
(
	[OptionalKey] ASC
)

GO

